{% extends 'base.html.twig' %}
{% import 'Import/app_import.html.twig' as appImport %}

{% block head_title %}{{ 'component_templates'|trans }} - {{ template.name }}{% endblock %}

{% block heading_1 %}
    {{ appImport.heading({'level': 1, 'title': 'component_templates'|trans, 'link': {'url': path('component_templates')}}) }}
{% endblock %}

{% block heading_2 %}
    {{ appImport.heading({'level': 2, 'title': template.name}) }}
{% endblock %}

{% block tabs %}
    {% include 'Modules/component_template/component_template_read_tabs.html.twig' with {'active': 'summary'} %}
{% endblock %}

{% block main_content %}
    {% embed 'Embed/block_embed.html.twig' %}
        {% import 'Import/app_import.html.twig' as appImport %}
        {% block content %}
            {{ appImport.heading({'level': 3, 'title': 'summary'|trans}) }}

            {% embed 'Embed/buttons_embed.html.twig' %}
                {% import 'Import/app_import.html.twig' as appImport %}
                {% block content %}
                    {% if is_granted('COMPONENT_TEMPLATE_DELETE', template) %}
                        {{ appImport.buttonModal({
                            'id': 'ComponentTemplateDelete',
                            'title': 'delete'|trans,
                            'body': template.name,
                            'href': path('component_templates_delete', {'name': template.name}),
                        }) }}
                    {% endif %}

                    {% if is_granted('COMPONENT_TEMPLATE_COPY', template) %}
                        <a class="btn btn-primary btn-sm" href="{{ path('component_templates_create', {'template': template.name}) }}">{{ 'copy'|trans }}</a>
                    {% endif %}
                {% endblock %}
            {% endembed %}

            {% if template.version %}
                <p>
                    <strong>{{ 'version'|trans }}</strong><br>
                    {{ template.version }}
                </p>
            {% endif %}

            <p>
                <strong>{{ 'managed'|trans }}</strong><br>
                {% if template.isManaged %}
                    {{ appImport.badge({'title': 'boolean.true'|trans, 'context': 'true'}) }}
                {% else %}
                    {{ appImport.badge({'title': 'boolean.false'|trans, 'context': 'false'}) }}
                {% endif %}
            </p>
        {% endblock %}
    {% endembed %}
{% endblock %}
